<template>
    <el-button type="primary" size="mini" icon="el-icon-back" @click="handleReback">{{ title }} </el-button>
</template>
<script>
export default {
    name: "BackButton",
    props: {
        title: {
            type: String,
            default: "返回救援计划列表",
        },
        back: {
            type: Object,
            default: null,
        },
    },
    methods: {
        handleReback() {
            if (this.back) {
                // 关闭当前页并切换另一个tab
                this.$tab.closePage().then(res => {
                    this.$tab.openPage(this.back.title, this.back.url, {});
                });
            }
        },
    },
};
</script>
<style lang="scss" scoped></style>
